package no.mehdi.usereg.web.action;

import no.mehdi.usereg.core.service.PersonService;
import no.mehdi.usereg.web.form.PersonListForm;

import org.springframework.webflow.action.FormAction;
import org.springframework.webflow.execution.Event;
import org.springframework.webflow.execution.RequestContext;

public class PersonListAction extends FormAction {
	private PersonService personService;

 @Override
	protected Object createFormObject(RequestContext context) throws Exception {
		PersonListForm form= (PersonListForm) super.createFormObject(context);
		form.setPersons(personService.getAllRegisteredPerson());
		return form;
	}

	public void remove() {
		
	}
	
	public Event refreshForm(RequestContext context) throws Exception{
		PersonListForm form=(PersonListForm) getFormObject(context);
		form.setPersons(personService.getAllRegisteredPerson());
		return success();
	}
	public void setPersonService(PersonService personService) {
		this.personService = personService;
	}

}
